package com.legna.mhxy.support.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.legna.mhxy.support.dao.RingCategoryDao;
import com.legna.mhxy.support.dao.RingTypeDao;
import com.legna.mhxy.support.dao.UserRingDao;
import com.legna.mhxy.support.entity.RingCategory;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Service
@AllArgsConstructor
@Slf4j
public class RingCategoryService {
    private final RingCategoryDao ringCategoryDao;
    private final RingTypeDao ringTypeDao;
    private final UserRingDao userRingDao;

    public List<RingCategory> listAll(List<Integer> types){
        LambdaQueryWrapper<RingCategory> qw = new LambdaQueryWrapper<>();
        if (!CollectionUtils.isEmpty(types)){
            qw.in(RingCategory::getType,types);
        }
        return ringCategoryDao.selectList(qw);
    }
}
